*******************************************************************************
* Specify city and years; load data
*******************************************************************************

local city = "fort_worth"

local y1 2009
local y2 2014
local y3 2020

use dataset_`city'_panel, clear

******************************************************************************
* Change in support and share black
******************************************************************************

foreach year in `y2' `y3' {
	
	#delimit;

	gr tw
		(sc dturnout pctnhblack [aw=registeredvoters] if year ==`year',
			msym(Oh) msize(tiny))
		(lpoly dturnout pctnhblack [aw=registeredvoters] if
			year ==`year', col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			//yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g`y3', ycommon xcommon ///
	l1title("Change in Turnout") b1title("Share Black") ///
	rows(1) xsize(2) ysize(1) 

gr export "_output/figure A14 a.pdf", replace

*******************************************************************************
* Change and support and distance to shooting
*******************************************************************************

foreach year in `y2' `y3'{
	
	#delimit;

	gr tw
		(sc dturnout distance [aw=registeredvoters] if year == `year',
			msym(Oh) msize(tiny))
		(lpoly dturnout distance [aw=registeredvoters] if
			year == `year',	col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			//yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			xscale(reverse)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g2020, ycommon xcommon ///
	l1title("Change in Turnout") b1title("Distance to Shooting (Miles)") ///
	rows(1) xsize(2) ysize(1)
	
gr export "_output/figure A14 b.pdf", replace
	
********************************************************************************
* End
********************************************************************************
